package com.comac.print.component.app.domain.gateway.enums;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;

/**
 * @Description 模板状态
 * @Author yy
 * @Date 2022/04/10 22:13
 */
public enum MpStatusEnum {
    MP_LOSE("00","失效"),
    MP_RELEASE("01","发布");

    @Getter
    @Setter
    private String code;
    @Getter
    @Setter
    private String description;

    MpStatusEnum(String code, String description){
        this.code = code;
        this.description= description;
    }

    /**
     * 通过code获取枚举值
     * @param code
     * @return
     */
    public static MpStatusEnum getMpStatusEnumByCode(String code){
        return Arrays.stream(MpStatusEnum.values())
                .filter(mpStatusEnum -> mpStatusEnum.getCode().equals(code))
                .findFirst().orElse(null);
    }
}
